{% extends 'base.html' %}

{% block content %}
<div class="simpleui-box simpleui-row">
    <table>
        <tr>
            <th>序号</th>
            <th>分类名称</th>
            <th>操作</th>
        </tr>
        {% for sort in sorts %}
        <tr>
            <td>{{ sort.id }}</td>
            <td>{{ sort.name }}</td>
            <td>
                <a href="/sorts/{{ sort.id }}"><button>编辑</button></a>
                <a href="/sorts/0"><button>添加</button></a>

                <form method="POST" action="/sorts/{{ sort.id }}" style="display: inline-block;">
                    <input type="hidden" name="_method" value="DELETE"><!--由于 form 表单不支持 put/delete , 这个使用参数欺骗-->
                    <input type="submit" name="delete" value="删除" onclick="return confirm('确定要删除吗?')">
                </form>
            </td>
        </tr>
        {% endfor %}
    </table>
</div>
{% endblock %}
